//
//  MCPersonInformationHeaderView.m
//  TLYL
//
//  Created by MC on 2017/6/14.
//  Copyright © 2017年 TLYL01. All rights reserved.
//

#import "MCPersonInformationHeaderView.h"
@interface MCPersonInformationHeaderView ()

//打底的view
@property (nonatomic,strong)UIView * view_back;

//用户名
@property (nonatomic,strong)UILabel * lab_name;

//返点
@property (nonatomic,strong)UILabel * lab_rebate;

@end

@implementation MCPersonInformationHeaderView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createUI];
    }
    return self;
}

-(void)createUI{
    
    self.backgroundColor=[UIColor cyanColor];
    
    _view_back=[[UIView alloc]init];
    [self addSubview:_view_back];
    _view_back.backgroundColor=[UIColor whiteColor];
    _view_back.layer.cornerRadius=5;
    _view_back.layer.borderColor=[UIColor grayColor].CGColor;
    _view_back.layer.borderWidth=1.0;
    
    
    _lab_name = [[UILabel alloc]init];
    _lab_name.layer.cornerRadius=5;
    _lab_name.backgroundColor = [UIColor clearColor];
    _lab_name.layer.masksToBounds = YES;
    _lab_name.font = [UIFont systemFontOfSize:15];
    _lab_name.numberOfLines=1;
    _lab_name.text = @"用户名：Kaka";
    _lab_name.textAlignment=NSTextAlignmentLeft;
    [_view_back addSubview:_lab_name];
    
    _lab_rebate = [[UILabel alloc]init];
    _lab_rebate.layer.cornerRadius=5;
    _lab_rebate.backgroundColor = [UIColor clearColor];
    _lab_rebate.layer.masksToBounds = YES;
    _lab_rebate.font = [UIFont systemFontOfSize:15];
    _lab_rebate.numberOfLines=1;
    _lab_rebate.text = @"返点：1956";
    _lab_rebate.textAlignment=NSTextAlignmentRight;
    [_view_back addSubview:_lab_rebate];
    
    [self layOutConstraints];
}


-(void)layOutConstraints{
    
    [_view_back mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(10);
        make.top.equalTo(self.mas_top).offset(10);
        make.bottom.equalTo(self.mas_bottom).offset(-10);
        make.right.equalTo(self.mas_right).offset(-10);

    }];
    
    
    [_lab_name mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_view_back.mas_left).offset(10);
        make.centerY.equalTo(_view_back.mas_centerY);
        make.right.equalTo(_view_back.mas_right).offset(-10);
    }];
    
    [_lab_rebate mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_view_back.mas_left).offset(10);
        make.centerY.equalTo(_view_back.mas_centerY);
        make.right.equalTo(_view_back.mas_right).offset(-10);
    }];

    
}

-(void)setDataSource:(id)dataSource{
    _dataSource=dataSource;
}

+(CGFloat)computeHeight:(id)info{
    
    return 60;
}

/*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.
 - (void)drawRect:(CGRect)rect {
 // Drawing code
 }
 */

@end
